﻿using Autodesk.AutoCAD.DatabaseServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XS.Tunnel.Cad.SteelBracing.Component.SteelShotcrete.UniversalBeamComponent;
using XS.Tunnel.Cad.SteelBracing.Component;
using XS.Tunnel.Cad.SteelBracing.Infrastructure;
using XS.Tunnel.Cad.SteelBracing.Infrastructure.Extensions;
using XS.Tunnel.Cad.SteelBracing.Component.SteelShotcrete;
using Autodesk.AutoCAD.Geometry;

namespace XS.Tunnel.Cad.SteelBracing.BusinessExtensions
{
    public static class PointExtensions
    {
        /// <summary>
        /// 缩进
        /// </summary>
        public static List<ISysPoint> ArchRingRetract(this List<ISysPoint> values, double l)
        {
            var list = new List<ISysPoint>();
            foreach (var item in values)
            {
                if (item is ArcPoint)
                {
                    list.Add(item.ArcRetract(l));
                }
                else
                {
                    if (item.Code == StructurePointLocationConstant.RightLine)
                    {
                        list.Add(item.LineRetract(l));
                    }
                    if (item.Code == StructurePointLocationConstant.LeftLine)
                    {
                        list.Add(item.LineRetract(l, false));
                    }

                    if (item.Code == StructurePointLocationConstant.LeftboostVerticalLine)
                    {
                        list.Add(item.LineRetract(l, false));
                    }
                    if (item.Code == StructurePointLocationConstant.RightboostVerticalLine)
                    {
                        list.Add(item.LineRetract(l));
                    }
                  
                }
            }
            return list;
        }

        /// <summary>
        /// 仰拱缩进
        /// </summary>
        public static List<ISysPoint> InvertedArchRetract(this List<ISysPoint> values, double l)
        {
            var list = new List<ISysPoint>();
            foreach (var item in values)
            {
                if (item is ArcPoint)
                {
                    list.Add(item.ArcRetract(l));
                }
                else  // 大墙角  左右直线
                {
                    var line = item as LinePoint;
                    var ll = new LinePoint(line.X, line.Y+l, line.X1, line.Y1+l);
                    ll.Code = line.Code;
                    list.Add(ll);
                }
            }
            return list;
        }


       

        public static IEnumerable<Curve> CreateSteelPlate(this Line line, SteelPlateParameter param)
        {
            var list=new List<Curve>();  

            var d = new SteelPlateComponent(line, param);
            if (param.Count == 1)
            {
               
            }
            else if (param.Count == 2)
            {
                list.Add(d.Create());
                list.Add(d.Create(false));
            }
            else if (param.Count == 4)
            {
              

            }
            else
            { 
            
            }
            return list;
        }


       





    }
}
